package com.ns.dcjh.utils;

import android.content.Context;
import android.os.Vibrator;

public class VibratorUtil {

    private Vibrator vibrator;

    public VibratorUtil(Context context){
        vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
    }

    public void open(long milliseconds){
        vibrator.vibrate(milliseconds);
    }

    public void cancel(){
        if (vibrator!=null){
            vibrator.cancel();
        }
    }

}
